var task_example_data =
  [
    {
      "id": "298",
      "title": "简单任务视图",
      "parent": "211",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-26 19:04:59",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "如果只是简单的任务，你懒得分类组织，那可以使用简单任务视图，只需输入、新增就好。",
      "tags": "",
      "intags": "",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-06 16:37:48",
      "parents": "211,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "212",
      "title": "分类任务视图",
      "parent": "211",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:54",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "任务是按层次结构组织的，一个任务可以分解成多个子任务。",
      "tags": "",
      "intags": "",
      "sort": "99",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-06 16:37:51",
      "parents": "211,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "213",
      "title": "日历视图",
      "parent": "211",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:12",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "按任务安排的日期在日历界面上显示，在上面拖动任务可以改变任务的日期",
      "tags": "",
      "intags": "",
      "sort": "99",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-06 16:37:50",
      "parents": "211,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "214",
      "title": "按任务状态筛选",
      "parent": "211",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:25",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "使用右上角的筛选按扭，可以筛选列出指定状态的任务。",
      "tags": "",
      "intags": "",
      "sort": "99",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-06 16:37:49",
      "parents": "211,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "215",
      "title": "搜索视图",
      "parent": "211",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:33",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "任务标题和标签搜索，多个关键词用空格分隔，可以搜索已归档 的任务哟！",
      "tags": "",
      "intags": "",
      "sort": "99",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-06 16:37:48",
      "parents": "211,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "6371",
      "title": "历史视图",
      "parent": "211",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-11-06 16:11:12",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "列出指定日期添加的任务。",
      "tags": "",
      "intags": "",
      "sort": "98",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": "0",
      "lastupdate": "2016-11-06 16:39:56",
      "parents": "211,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "3357",
      "title": "图片",
      "parent": "216",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-09-24 09:09:06",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "给任务添加一个图片，目前仅支持网络图片，即输入一个图片网址",
      "tags": "测试功能",
      "intags": "",
      "sort": "746819860",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": "http://www.thinktodo.cn/_assets/img/logo.png",
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": "0",
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "216,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "3355",
      "title": "状态",
      "parent": "216",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-09-24 09:09:11",
      "stage": "urgent",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "调出工具栏的底行按扭，可以设置任务的当前状态，包括：无状态、问题、思路、进行中、暂停、紧急、交办、交差、完成、撤消。",
      "tags": "",
      "intags": "",
      "sort": "746816310",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": "0",
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "216,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "217",
      "title": "标签",
      "parent": "216",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:20",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "可为任务添加一个或多个标签，用于分类或者便于查找，多个标签输入时用空格分隔，标签被显示在任务标题之后，点击右上角的“显示/隐藏标签”按扭可以显示或隐藏所有标签。",
      "tags": "重要 老板交待",
      "intags": "fa-tag",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "216,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "218",
      "title": "外部链接",
      "parent": "216",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:34",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "给任务添加外链，就象本任务一样",
      "tags": "",
      "intags": "fa-link",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": "http://www.baidu.com",
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "216,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "219",
      "title": "内部链接",
      "parent": "216",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:53",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "将任务关联到其他任务，\n先选择取被关联的任务（在任务标题上点击，任务出现底色），再回到要关联的任务上，点击“内链”按扭，输入框中默认已填写了被关联的任务号，你也可手工输入被关联任务的ID编号（在调出工具栏的方向键上悬停可以看到），确认后即提交。",
      "tags": "",
      "intags": "",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": "232",
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "216,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "220",
      "title": "注释",
      "parent": "216",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:03",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "给任务添加注释，就像本帮助一样",
      "tags": "",
      "intags": "",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "216,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "229",
      "title": "日期",
      "parent": "216",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:47",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "打开日历视图，将任务从分类任务视图拖放到日历视图即可安排任务的日期，从日历视图拖回到任务视图即可取消日期安排。有日期安排的任务标题后会显示日期，点击右上角的“显示/隐藏日期”按扭可以设置。",
      "tags": "",
      "intags": "",
      "sort": "100",
      "start_date": "2015-04-06 00:00:00",
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "216,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "225",
      "title": "上移/下移任务的顺序",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:15",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "通过上下方向图标，可以调整它在同级任务中的顺序。你可以使用拖放调整顺序，但要放好位置哦!",
      "tags": "",
      "intags": "",
      "sort": "746818960",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "226",
      "title": "刷新子任务",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:25",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "向服务器查询，该任务是否有下级子任务并列出",
      "tags": "",
      "intags": "",
      "sort": "1001",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "230",
      "title": "折叠/展开子任务",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 18:04:54",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "点击任务标题前的文件夹图标，可以展开或收起子任务列表。（注：有时你需要先服务器刷新它的子任务列表，以与服务器保持一致）",
      "tags": "",
      "intags": "",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "232",
      "title": "调出工具栏",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 20:04:06",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "点击任务标题右方的双右箭头图标，可以调出工具栏，点击工具栏上的各个图标，可以对该任务进行各种操作，点击工具右上角的叉图标，可以关闭工具栏。\n注：本帮助视图禁用了工具栏。",
      "tags": "",
      "intags": "",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "254",
      "title": "调整任务的层次",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-10 11:04:14",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "可以将一个任务拖放到其它任务下，变成它的子任务。\n",
      "tags": "",
      "intags": "",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "222",
      "title": "增加子任务",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:05",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "在这里，任务可以被逐级分解的，你要做的是，从根任务开始，逐级地增加子任务。\n快捷键秘技：Enter键提交，Ctrl+Enter键提交且继续新增。",
      "tags": "",
      "intags": "",
      "sort": "99",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "223",
      "title": "删除任务",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:16",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "注意，不能删除含有子任务的任务",
      "tags": "",
      "intags": "",
      "sort": "98",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "224",
      "title": "编辑任务",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2015-04-05 14:04:38",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "如果任务标题不合适，你可以修改它。",
      "tags": "",
      "intags": "",
      "sort": "98",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "3356",
      "title": "归档任务",
      "parent": "221",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-09-24 09:09:36",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "归档后，任务被保存到数据库中，默认不显示，但可通过搜索找到它",
      "tags": "",
      "intags": "",
      "sort": "97",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": "0",
      "lastupdate": "2016-10-25 14:43:09",
      "parents": "221,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "221",
      "title": "基本操作",
      "parent": "231",
      "uid": "3",
      "haschild": "1",
      "in_date": "2015-04-05 14:04:54",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": null,
      "tags": "",
      "intags": "",
      "sort": "672924200",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "216",
      "title": "为任务附加相关信息",
      "parent": "231",
      "uid": "3",
      "haschild": "1",
      "in_date": "2015-04-05 14:04:04",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": null,
      "tags": "",
      "intags": "",
      "sort": "100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:03:03",
      "parents": "231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "211",
      "title": "以不同的方式查看任务",
      "parent": "231",
      "uid": "3",
      "haschild": "1",
      "in_date": "2015-04-05 14:04:39",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "0",
      "comment": "任务可以被多种方式组织和展现，点击页面上每个大图标可以打开或关闭一种任务视图。",
      "tags": "",
      "intags": "",
      "sort": "99",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:03:03",
      "parents": "231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1523",
      "title": "秘技（一般人不告诉）",
      "parent": "231",
      "uid": "3",
      "haschild": "1",
      "in_date": "2016-06-30 21:06:40",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": null,
      "tags": "",
      "intags": "",
      "sort": "98",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:03:03",
      "parents": "231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1935",
      "title": "快捷键",
      "parent": "1523",
      "uid": "3",
      "haschild": "1",
      "in_date": "2016-07-08 21:07:42",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": null,
      "tags": "测试功能",
      "intags": "",
      "sort": "679833820",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1868",
      "title": "发布任务内容",
      "parent": "1523",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-07-06 22:07:09",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "点击\"发布\"按钮，会将任务及下级任务的最新内容发布",
      "tags": "测试功能",
      "intags": "",
      "sort": "678165490",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1524",
      "title": "样式标签",
      "parent": "1523",
      "uid": "3",
      "haschild": "1",
      "in_date": "2016-06-30 21:06:16",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "点击\"样式标签\"按钮，可给任务添加具体样式。",
      "tags": "",
      "intags": "fa-gears",
      "sort": "672924560",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1895",
      "title": "表现重要程度",
      "parent": "1524",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-07-07 21:07:55",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "加!标签吧，很重要，就加多个!标签。",
      "tags": "!!!",
      "intags": "",
      "sort": "678977750",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1524,1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1527",
      "title": "层次背景色",
      "parent": "1524",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-06-30 21:06:48",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "在样式标签中添加“le1”\"le2\"\"le3\"...\"le8\"，即可给任务标题显示不同深浅的背景色",
      "tags": "",
      "intags": "",
      "sort": "672927280",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1524,1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1526",
      "title": "显示序号",
      "parent": "1524",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-06-30 21:06:46",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "在样式标签中加上“显示序号”，即可在下级任务中显示序号",
      "tags": "",
      "intags": "",
      "sort": "672926660",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1524,1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1525",
      "title": "给任务添加图标",
      "parent": "1524",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-06-30 21:06:10",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "要给任务标题附加font awesome图标，只需要在样式标签中添加相应图标标签名，如fa-star，多个标签用空格隔开",
      "tags": "",
      "intags": "",
      "sort": "672925100",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": "http://www.thinkcmf.com/font/",
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1524,1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1936",
      "title": "Ctrl+方向键：选择当前任务",
      "parent": "1935",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-07-08 21:07:11",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "Ctrl+上下方向键：选择同级的上/下一个任务\nCtrl+左右方向键：选择上/下级任务\n在用快捷键之前，要用鼠标先点选一个任务作为当前任务。",
      "tags": "",
      "intags": "",
      "sort": "679838180",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1935,1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1937",
      "title": "Ctrl+Insert键：添加子任务",
      "parent": "1935",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-07-08 21:07:36",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "给当前任务增加子任务",
      "tags": "",
      "intags": "",
      "sort": "679837360",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1935,1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    },
    {
      "id": "1938",
      "title": "Ctrl+Enter键：提交子任务且继续增加",
      "parent": "1935",
      "uid": "3",
      "haschild": "0",
      "in_date": "2016-07-08 21:07:58",
      "stage": "",
      "active": "0",
      "archive": "0",
      "attention": "100",
      "comment": "在新增子任务时，通常按\"Enter\"键可提交。如果你想连续输入多个子任务可以使用Ctrl+Enter键",
      "tags": "",
      "intags": "",
      "sort": "679835310",
      "start_date": null,
      "end_date": null,
      "allday": "0",
      "nodetype": "",
      "link": null,
      "photo": null,
      "internal_link": null,
      "gid": null,
      "pub": "0",
      "areaid": null,
      "lastupdate": "2016-11-14 11:19:14",
      "parents": "1935,1523,231,1,0",
      "simple": "0",
      "num": null,
      "tid": null,
      "set": null,
      "id2": null
    }
  ];



function list_to_tree(obj_array) {

  list = {};
  // list = new Array();
  // 如用数组作临时存储结构，因为id不连续，往往又很大，出现很多空下标。如指定了list[2]，那么就有list[0]=null、list[1]=null，不够优雅
  
  var tree_obj = {
    title: '根目录',
    children: []
  };


  obj_array.forEach(function (item) {
    list[item.id] = item;
    list[item.id].children = new Array();
  });
  // console.log(list);
  obj_array.forEach(function (item) {
    // console.log(item);

    if (item.parent) {
      // console.log(list[item.parent]);
      // console.log(list[item.id]);
      
      if (list[item.parent]) {
        // 将该对象挂装到父对象的children下，实际上在父对象的children下增加了一引用
        list[item.parent].children.push(list[item.id]);

        // let parent = map[item.pid];
        // if(parent) {
        //     (parent.children || (parent.children = [])).push(item);
        // } 网络上一种更为优雅的写法，若不存在childre，则创建children，并压入

      } else {
        // 如果不存在该父对象，则其为顶层节点，将其压入到要返回到的tree_obj中
        tree_obj.children.push(item);
      }
      // console.log(list[item.parent]);
      // console.log("-");

    }
  });
  // console.log(list);
  return tree_obj;
}

var tree_example = list_to_tree(task_example_data);
// console.log(list[231]);
// console.log(tree_root);


// 差不多的写法
  // const list2Tree = (list: any[], { id = 'id', pid = 'parent', isLeaf = 'isLeaf' }) => {
  //   const treeList: any[] = [];
  //   const dataMap = {};
  //   if (list && list.length > 0) {
  //     list.forEach((item) => {
  //       dataMap[item[id]] = item;
  //     });
  //     list.forEach((item) => {
  //       const parent = dataMap[item[pid]];
  //       if (item[isLeaf]) {
  //         const pItem = item;
  //         pItem.children = [];
  //       }
  //       if (!parent) {
  //         treeList.push(item);
  //         return;
  //       }
  //       if (!parent.children) {
  //         parent.children = [];
  //       }

  //       parent.children.push(item);
  //     });
  //   }

  //   return treeList;
  // };
